import { useState } from "react";

import { useArray } from "utils/hooks/use-array";

export const TryUseArrayTs = () => {
  const params: { name: string; id: string }[] = [
    {
      name: 'jj',
      id: '1'
    }
  ];
  const { arr, add, removeIndex, clear } = useArray(params);
  return (
    <div className="array-container">
      <button type="button" onClick={() => { add({ name: 'add', id: '6' }) }}>add</button>
      <button type="button" onClick={() => { removeIndex(0) }}>removeIndex 0</button>
      <button type="button" onClick={() => { clear() }}>clear</button>
      {arr.map(item => (<div>{item.name}</div>))}
    </div>
  );
}
